﻿<div class="page-heading">
		<h1>Sửa tin tức</h1>
</div>
<div class="page-content">
    <div class="msg-box hidden" id="msg-newsedit">
        <span class="msg">Sửa tin tức thành công.</span>
    </div>
    <div class="error-box hidden" id="err-newsedit">
        
    </div>
    <form id="form" method="post" enctype="multipart/form-data">
        <input type="hidden" name="submit" value="true" />
        <input type="hidden" name="Id" value="{edit_id}" />
        <div class="admin-row">
            <div class="left"><label>Danh mục tin tức</label></div>
            <div class="right">
                {cat}
            </div>
        </div>
        <div class="admin-row">
            <div class="left"><label>Tiêu đề</label></div>
            <div class="right">{name}</div>
        </div>
        <div class="admin-row">
            <div class="left"><label>Chi tiết</label></div>
            <div class="right"><textarea name="Detail" id="news_detail">{Detail}</textarea></div>
        </div>
        <div class="admin-row">
            <div class="left"><label>Chi tiết</label></div>
            <div class="right"><textarea name="ViDetail" id="news_videtail">{ViDetail}</textarea></div>
        </div>
        <div class="admin-row">
            <div class="left">&nbsp;</div>
            <div class="right">
                <input class="button" type="submit" value="Lưu lại" />
                <a class="button" onclick="location='{BaseUrl}/admin/news'" >Hủy bỏ</a>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    $('#news_detail').cleditor({ width: "100%", height: "500px", docCSSFile: "{ResourceUrl}/css/editor.css" });
    $('#news_videtail').cleditor({ width: "100%", height: "500px", docCSSFile: "{ResourceUrl}/css/editor.css" });
   
    function removeTag(tagId) {
        $('#tagitem_' + tagId).remove();
        if(tagsedit[tagId]!=undefined) tagsedit[tagId] += -1;
        else tagsedit[tagId] = -1;
        
    }
    
    $('#form').submit(function () {
        if(tagsedit.length){
            var str = "[";
            for(var i in tagsedit){
                str += '{"Id":'+i+',"Task":'+tagsedit[i]+'},';
            }
            str = str.substring(0, str.lastIndexOf(","));
            str += "]";
            $('#tagsFormData').val(str);
            //alert(str);
        }
        return true;
    });
</script>